package com.sojson.util.search.es.condition;

import com.sojson.config.condition.MyConfigurationCondition;
import com.sojson.constant.Constant;
import com.sojson.util.StringUtil;
import com.sojson.util.search.enums.ESearchType;

/**
 * 启动ES
 *
 * @author liu
 * @date 2021-04-28
 */
public class EsCondittion extends MyConfigurationCondition {

    @Override
    public boolean matches() {
        String property = Constant.PROPERTIES.getProperty("so.search.enables");
        if (StringUtil.isBlank(property)) {
            return false;
        }

        String[] split = property.split(StringUtil.D);
        for (String type : split) {
            if (ESearchType.ES.getCode().equals(type)) {
                return true;
            }
        }
        return false;
    }

}